package com.shiliao.app.activity.interlocution.presenter;

import android.text.TextUtils;

import com.shiliao.app.activity.interlocution.service.IMyQuestionService;
import com.shiliao.app.activity.interlocution.service.impl.MyQuestionImpl;
import com.shiliao.app.activity.interlocution.view.MyQuestionView;
import com.shiliao.app.utils.YMServerUtil;
import com.yimei.framework.mvp.presenter.IBasePresenter;
import com.yimei.framework.network.ICallBack;
import com.yimei.framework.util.LogUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yinzhiqiang on 2017/10/10.
 */

public class MyQuestionPresenter extends IBasePresenter<IMyQuestionService> {
    private MyQuestionView myQuestionView;
    private IMyQuestionService myQuestionService;

    public MyQuestionPresenter(MyQuestionView myQuestionView) {
        this.myQuestionView = myQuestionView;
        myQuestionService=new MyQuestionImpl();
        setService(myQuestionService);
    }

    public void requestMyQuestionList(String userId){
        Map map=new HashMap();
        if (!TextUtils.isEmpty(userId)){
            map.put("user_id",userId);
        }
        myQuestionService.requestMyQuestionList(YMServerUtil.ACTION_MY_QUESTION, map, new ICallBack() {
            @Override
            public void onSuccess(int statusCode, Object result) {
                LogUtil.e("yzq",result.toString());
                myQuestionView.loadWebView(result.toString());
            }

            @Override
            public void onFail(int statusCode, Object result) {
                LogUtil.e("yzq",result.toString());
                myQuestionView.loadWebView(result.toString());
            }
        });
    }
}
